import { ElementDSL } from '../ElementDSL'
import type { ModelValueType } from '../DslType'
import { ElSelect } from 'element-plus'

export class Select extends ElementDSL {
  constructor() {
    super(ElSelect)
  }
  /* 	选中项绑定值 */
  modelValue(value: ModelValueType): this {
    return super.setProps('modelValue', value)
  }
  /* 新增属性 */
  automaticDropdown(value: boolean): this {
    return super.setProps('automatic-dropdown', value)
  }

  allowCreate(value: boolean): this {
    return super.setProps('allow-create', value)
  }

  filterMethod(value: Function): this {
    return super.setProps('filter-method', value)
  }

  /* 新增插槽 */
  default(content: string): this {
    return super.setSlot('default', content)
  }

  multiple(value: boolean): this {
    return super.setProps('multiple', value)
  }

  disabled(value: boolean): this {
    return super.setProps('disabled', value)
  }

  size(value: 'large' | 'default' | 'small'): this {
    return super.setProps('size', value)
  }

  clearable(value: boolean): this {
    return super.setProps('clearable', value)
  }

  collapseTags(value: boolean): this {
    return super.setProps('collapse-tags', value)
  }

  multipleLimit(value: number): this {
    return super.setProps('multiple-limit', value)
  }

  reserveKeyword(value: boolean): this {
    return super.setProps('reserve-keyword', value)
  }

  defaultFirstOption(value: boolean): this {
    return super.setProps('default-first-option', value)
  }

  /* 文本相关 */
  placeholder(value: string): this {
    return super.setProps('placeholder', value)
  }

  noMatchText(value: string): this {
    return super.setProps('no-match-text', value)
  }

  noDataText(value: string): this {
    return super.setProps('no-data-text', value)
  }

  /* 搜索相关 */
  filterable(value: boolean): this {
    return super.setProps('filterable', value)
  }

  remote(value: boolean): this {
    return super.setProps('remote', value)
  }

  remoteMethod(value: (...args: any[]) => string): this {
    return super.setProps('remote-method', value.apply(this))
  }

  loading(value: boolean): this {
    return super.setProps('loading', value)
  }

  loadingText(value: string): this {
    return super.setProps('loading-text', value)
  }

  /* 样式类 */
  popperClass(value: string): this {
    return super.setProps('popper-class', value)
  }
}
